<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>OpenFOAM 中的边界条件（三） | Giskard&#39;s CFD Learning Tricks</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="OpenFOAM 中有很多复杂的边界都是继承自上篇中提到的三个基础边界条件，这些边界条件的代码在上一篇的基础上就很容易看懂了。只不过，还有一些边界条件，不是继承自这三个基础边界条件的，其中有一些都直接或间接继承自另一个重要的边界条件： transformFvPatchField。本篇来看看这个 transformFvPatchField 以及几个继承自它的边界条件。">
<meta property="og:type" content="article">
<meta property="og:title" content="OpenFOAM 中的边界条件（三）">
<meta property="og:url" content="http://xiaopingqiu.github.io/2016/04/02/Boundary-conditions-in-OpenFOAM3/index.html">
<meta property="og:site_name" content="Giskard's CFD Learning Tricks">
<meta property="og:description" content="OpenFOAM 中有很多复杂的边界都是继承自上篇中提到的三个基础边界条件，这些边界条件的代码在上一篇的基础上就很容易看懂了。只不过，还有一些边界条件，不是继承自这三个基础边界条件的，其中有一些都直接或间接继承自另一个重要的边界条件： transformFvPatchField。本篇来看看这个 transformFvPatchField 以及几个继承自它的边界条件。">
<meta property="og:image" content="/image/boundaryConditions/boundary-conditions-in-openfoam-90.jpg">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="OpenFOAM 中的边界条件（三）">
<meta name="twitter:description" content="OpenFOAM 中有很多复杂的边界都是继承自上篇中提到的三个基础边界条件，这些边界条件的代码在上一篇的基础上就很容易看懂了。只不过，还有一些边界条件，不是继承自这三个基础边界条件的，其中有一些都直接或间接继承自另一个重要的边界条件： transformFvPatchField。本篇来看看这个 transformFvPatchField 以及几个继承自它的边界条件。">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css" type="text/css">
  
<!-- Google Analytics -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

##ga('create', '[object Object]', 'auto');
ga('create', 'UA-62501686-1', 'auto');
ga('send', 'pageview');

</script>
<!-- End Google Analytics -->


</head>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Giskard&#39;s CFD Learning Tricks</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">CFD and Scientific Computing</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
          <a class="main-nav-link" href="/atom.xml">Rss</a>
        
          <a class="main-nav-link" href="/about">About</a>
        
      </nav>
      <nav id="sub-nav">
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="q" value="site:http://xiaopingqiu.github.io"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main"><article id="post-Boundary-conditions-in-OpenFOAM3" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2016/04/02/Boundary-conditions-in-OpenFOAM3/" class="article-date">
  <time datetime="2016-04-02T09:29:16.000Z" itemprop="datePublished">2016-04-02</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/OpenFOAM/">OpenFOAM</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      OpenFOAM 中的边界条件（三）
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>OpenFOAM 中有很多复杂的边界都是继承自上篇中提到的三个基础边界条件，这些边界条件的代码在上一篇的基础上就很容易看懂了。只不过，还有一些边界条件，不是继承自这三个基础边界条件的，其中有一些都直接或间接继承自另一个重要的边界条件： <code>transformFvPatchField</code>。本篇来看看这个 <code>transformFvPatchField</code> 以及几个继承自它的边界条件。</p>
<a id="more"></a>
<h5 id="5-_transform">5. transform</h5><p>这是一个抽象基类，主要注意一下四个函数的定义：<br><figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; transformFvPatchField&lt;<span class="type">Type</span>&gt;::valueInternalCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> pTraits&lt;<span class="type">Type</span>&gt;::one - snGradTransformDiag();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; transformFvPatchField&lt;<span class="type">Type</span>&gt;::valueBoundaryCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span></span><br><span class="line">        *this</span><br><span class="line">      - cmptMultiply</span><br><span class="line">        (</span><br><span class="line">            valueInternalCoeffs(this-&gt;patch().weights()),</span><br><span class="line">            this-&gt;patchInternalField()</span><br><span class="line">        );</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; transformFvPatchField&lt;<span class="type">Type</span>&gt;::gradientInternalCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> -this-&gt;patch().deltaCoeffs()*snGradTransformDiag();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; transformFvPatchField&lt;<span class="type">Type</span>&gt;::gradientBoundaryCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span></span><br><span class="line">        snGrad()</span><br><span class="line">      - cmptMultiply(gradientInternalCoeffs(), this-&gt;patchInternalField());</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>由于 <code>snGrad</code> 和 <code>snGradTransformDiag</code> 都是纯虚函数，所以这四个函数的具体返回值需要在派生类中实现了 <code>snGrad</code> 和 <code>snGradTransformDiag</code> 之后才能确定。<br>另外注意，当模板参数为 <code>scalar</code> 时， <code>gradientInternalCoeffs</code> 函数有特殊的定义：<br><figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;&gt;</span><br><span class="line">tmp&lt;scalarField &gt; transformFvPatchField&lt;scalar&gt;::gradientInternalCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp&lt;scalarField &gt;(new scalarField(size(), <span class="number">0</span>.<span class="number">0</span>));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<h5 id="6-_directionMixed">6. directionMixed</h5><p>这个类，跟前面的 <code>mixed</code> 有点类似，但是又继承自 <code>transform</code> ，所以，似乎是二者的结合。<br><figure class="highlight fortran"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">template&lt;<span class="keyword">class</span> <span class="keyword">Type</span>&gt;</span><br><span class="line"><span class="keyword">class</span> directionMixedFvPatchField</span><br><span class="line">:</span><br><span class="line">    <span class="keyword">public</span> transformFvPatchField&lt;<span class="keyword">Type</span>&gt;</span><br><span class="line">&#123;</span><br><span class="line">    // <span class="keyword">Private</span> <span class="type">data</span></span><br><span class="line"></span><br><span class="line">        //- <span class="keyword">Value</span> field</span><br><span class="line">        Field&lt;<span class="keyword">Type</span>&gt; refValue_;</span><br><span class="line"></span><br><span class="line">        //- Normal gradient field</span><br><span class="line">        Field&lt;<span class="keyword">Type</span>&gt; refGrad_;</span><br><span class="line"></span><br><span class="line">        //- <span class="built_in">Fraction</span> (<span class="number">0</span>-<span class="number">1</span>) of <span class="keyword">value</span> used for boundary condition</span><br><span class="line">        symmTensorField valueFraction_;</span><br></pre></td></tr></table></figure></p>
<p>与 <code>mixed</code> 相似之处是，这里也定义了 <code>refValue_</code> ， <code>refGrad_</code> 和 <code>valueFraction_</code> 三个参数，所不同的是，这里的 <code>valueFraction_</code> 是一个对称张量。</p>
<p>接下来， <code>directionMixed</code> 定义了 <code>snGrad</code> 和 <code>snGradTransformDiag</code> 这两个函数</p>
<ul>
<li><p><code>snGrad</code> 和 <code>snGradTransformDiag</code></p>
<figure class="highlight elixir"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line">template&lt;class <span class="constant">Type&gt;</span></span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:tmp&lt;Foam</span><span class="symbol">:</span><span class="symbol">:Field&lt;Type&gt;</span> &gt;</span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:directionMixedFvPatchField&lt;Type&gt;</span><span class="symbol">:</span><span class="symbol">:snGrad</span>() const</span><br><span class="line">&#123;</span><br><span class="line">    const <span class="constant">Field&lt;Type&gt;</span> pif(this-&gt;patchInternalField());</span><br><span class="line"></span><br><span class="line">    tmp&lt;<span class="constant">Field&lt;Type&gt;</span> &gt; normalValue = transform(valueFraction<span class="constant">_</span>, refValue<span class="constant">_</span>);</span><br><span class="line"></span><br><span class="line">    tmp&lt;<span class="constant">Field&lt;Type&gt;</span> &gt; gradValue = pif + refGrad<span class="constant">_</span>/this-&gt;patch().deltaCoeffs();</span><br><span class="line"></span><br><span class="line">    tmp&lt;<span class="constant">Field&lt;Type&gt;</span> &gt; transformGradValue =</span><br><span class="line">        transform(<span class="constant">I </span>- valueFraction<span class="constant">_</span>, gradValue);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span></span><br><span class="line">        (normalValue + transformGradValue - pif)*</span><br><span class="line">        this-&gt;patch().deltaCoeffs();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">template&lt;class <span class="constant">Type&gt;</span></span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:tmp&lt;Foam</span><span class="symbol">:</span><span class="symbol">:Field&lt;Type&gt;</span> &gt;</span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:directionMixedFvPatchField&lt;Type&gt;</span><span class="symbol">:</span><span class="symbol">:snGradTransformDiag</span>() const</span><br><span class="line">&#123;</span><br><span class="line">    vectorField diag(valueFraction<span class="constant">_</span>.size());</span><br><span class="line"></span><br><span class="line">    diag.replace</span><br><span class="line">    (</span><br><span class="line">        <span class="symbol">vector:</span><span class="symbol">:X</span>,</span><br><span class="line">        sqrt(mag(valueFraction<span class="constant">_</span>.component(<span class="symbol">symmTensor:</span><span class="symbol">:XX</span>)))</span><br><span class="line">    );</span><br><span class="line">    diag.replace</span><br><span class="line">    (</span><br><span class="line">        <span class="symbol">vector:</span><span class="symbol">:Y</span>,</span><br><span class="line">        sqrt(mag(valueFraction<span class="constant">_</span>.component(<span class="symbol">symmTensor:</span><span class="symbol">:YY</span>)))</span><br><span class="line">    );</span><br><span class="line">    diag.replace</span><br><span class="line">    (</span><br><span class="line">        <span class="symbol">vector:</span><span class="symbol">:Z</span>,</span><br><span class="line">        sqrt(mag(valueFraction<span class="constant">_</span>.component(<span class="symbol">symmTensor:</span><span class="symbol">:ZZ</span>)))</span><br><span class="line">    );</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> transformFieldMask&lt;<span class="constant">Type&gt;</span>(pow&lt;vector, pTraits&lt;<span class="constant">Type&gt;</span><span class="symbol">:</span><span class="symbol">:rank&gt;</span>(diag));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p><code>evaluate</code> 函数</p>
<figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line"><span class="literal">void</span> Foam<span class="tag">::directionMixedFvPatchField</span><span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>(const Pstream<span class="tag">::commsTypes</span>)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="subst">!</span>this<span class="subst">-&gt;</span>updated())</span><br><span class="line">    &#123;</span><br><span class="line">        this<span class="subst">-&gt;</span>updateCoeffs();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span> normalValue <span class="subst">=</span> transform(valueFraction_, refValue_);</span><br><span class="line"></span><br><span class="line">    tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span> gradValue <span class="subst">=</span></span><br><span class="line">        this<span class="subst">-&gt;</span>patchInternalField() <span class="subst">+</span> refGrad_/this<span class="subst">-&gt;</span>patch()<span class="built_in">.</span>deltaCoeffs();</span><br><span class="line"></span><br><span class="line">    tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span> transformGradValue <span class="subst">=</span></span><br><span class="line">        transform(I <span class="subst">-</span> valueFraction_, gradValue);</span><br><span class="line"></span><br><span class="line">    Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::operator</span><span class="subst">=</span>(normalValue <span class="subst">+</span> transformGradValue);</span><br><span class="line"></span><br><span class="line">    transformFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h5 id="7-_basicSymmetry">7. basicSymmetry</h5><p>这个类的结构与 <code>directionMixed</code> 类似，对 <code>snGrad</code> ， <code>snGradTransformDiag</code> 和 <code>evaluate</code> 等几个函数进行了重新定义。</p>
<ul>
<li><p><code>snGrad</code> 和 <code>snGradTransformDiag</code></p>
<figure class="highlight elixir"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">template&lt;class <span class="constant">Type&gt;</span></span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:tmp&lt;Foam</span><span class="symbol">:</span><span class="symbol">:Field&lt;Type&gt;</span> &gt;</span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:basicSymmetryFvPatchField&lt;Type&gt;</span><span class="symbol">:</span><span class="symbol">:snGrad</span>() const</span><br><span class="line">&#123;</span><br><span class="line">    tmp&lt;vectorField&gt; nHat = this-&gt;patch().nf();</span><br><span class="line"></span><br><span class="line">    const <span class="constant">Field&lt;Type&gt;</span> iF(this-&gt;patchInternalField());</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span></span><br><span class="line">        (transform(<span class="constant">I </span>- <span class="number">2.0</span>*sqr(nHat), iF) - iF)</span><br><span class="line">       *(this-&gt;patch().deltaCoeffs()/<span class="number">2.0</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">template&lt;class <span class="constant">Type&gt;</span></span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:tmp&lt;Foam</span><span class="symbol">:</span><span class="symbol">:Field&lt;Type&gt;</span> &gt;</span><br><span class="line"><span class="constant">Foam:</span><span class="symbol">:basicSymmetryFvPatchField&lt;Type&gt;</span><span class="symbol">:</span><span class="symbol">:snGradTransformDiag</span>() const</span><br><span class="line">&#123;</span><br><span class="line">    const vectorField nHat(this-&gt;patch().nf());</span><br><span class="line"></span><br><span class="line">    vectorField diag(nHat.size());</span><br><span class="line"></span><br><span class="line">    diag.replace(<span class="symbol">vector:</span><span class="symbol">:X</span>, mag(nHat.component(<span class="symbol">vector:</span><span class="symbol">:X</span>)));</span><br><span class="line">    diag.replace(<span class="symbol">vector:</span><span class="symbol">:Y</span>, mag(nHat.component(<span class="symbol">vector:</span><span class="symbol">:Y</span>)));</span><br><span class="line">    diag.replace(<span class="symbol">vector:</span><span class="symbol">:Z</span>, mag(nHat.component(<span class="symbol">vector:</span><span class="symbol">:Z</span>)));</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> transformFieldMask&lt;<span class="constant">Type&gt;</span>(pow&lt;vector, pTraits&lt;<span class="constant">Type&gt;</span><span class="symbol">:</span><span class="symbol">:rank&gt;</span>(diag));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>evaluate</p>
<figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line"><span class="literal">void</span> Foam<span class="tag">::basicSymmetryFvPatchField</span><span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>(const Pstream<span class="tag">::commsTypes</span>)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="subst">!</span>this<span class="subst">-&gt;</span>updated())</span><br><span class="line">    &#123;</span><br><span class="line">        this<span class="subst">-&gt;</span>updateCoeffs();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    tmp<span class="subst">&lt;</span>vectorField<span class="subst">&gt;</span> nHat <span class="subst">=</span> this<span class="subst">-&gt;</span>patch()<span class="built_in">.</span>nf();</span><br><span class="line"></span><br><span class="line">    const Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="keyword">iF</span>(this<span class="subst">-&gt;</span>patchInternalField());</span><br><span class="line"></span><br><span class="line">    Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::operator</span><span class="subst">=</span></span><br><span class="line">    (</span><br><span class="line">        (<span class="keyword">iF</span> <span class="subst">+</span> transform(I <span class="subst">-</span> <span class="number">2.0</span><span class="subst">*</span>sqr(nHat), <span class="keyword">iF</span>))/<span class="number">2.0</span></span><br><span class="line">    );</span><br><span class="line"></span><br><span class="line">    transformFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>另外，值得注意的是，当模板参数 <code>Type</code> 是 <code>scalar</code> 时， <code>snGrad</code> 和 <code>evaluate</code> 函数有其他的定义：<br><figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;&gt;</span><br><span class="line"><span class="type">Foam</span>::tmp&lt;<span class="type">Foam</span>::scalarField&gt;</span><br><span class="line"><span class="type">Foam</span>::basicSymmetryFvPatchField&lt;<span class="type">Foam</span>::scalar&gt;::snGrad() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp&lt;scalarField &gt;(new scalarField(size(), <span class="number">0</span>.<span class="number">0</span>));</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;&gt;</span><br><span class="line"><span class="type">void</span> <span class="type">Foam</span>::basicSymmetryFvPatchField&lt;<span class="type">Foam</span>::scalar&gt;::evaluate</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> <span class="type">Pstream</span>::commsTypes</span><br><span class="line">)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">if</span> (!updated())</span><br><span class="line">    &#123;</span><br><span class="line">        updateCoeffs();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    scalarField::operator=(patchInternalField());</span><br><span class="line">    transformFvPatchField&lt;scalar&gt;::evaluate();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>从这两个函数可推断，当 <code>Type = scalar</code> 时， <code>basicSymmetry</code> 其实就相当于 <code>zeroGradient</code>。 </p>
<p>关于 <code>transform</code> 和 <code>transformFieldMask</code> 这两个函数，摸索了很久。前者涉及的源文件有 <a href="http://foam.sourceforge.net/docs/cpp/a07932_source.html" target="_blank" rel="external"><code>symmTransformField.C</code></a> ，<a href="http://foam.sourceforge.net/docs/cpp/a07942_source.html" target="_blank" rel="external"> <code>transformFieldTemplates.C</code> </a>；后者的定义在 <a href="http://foam.sourceforge.net/docs/cpp/a07933_source.html" target="_blank" rel="external"><code>symmTransformField.H</code></a>，涉及到的 <code>pow</code> 函数的定义在<a href="http://foam.sourceforge.net/docs/cpp/a07889_source.html" target="_blank" rel="external"><code>FieldFunctions.C</code></a>。此外，这两个函数还需要用到类似 <code>TFOR_ALL_F_OP_FUNC_F_F</code> 的宏，定义在<a href="http://foam.sourceforge.net/docs/cpp/a07893_source.html#l00153" target="_blank" rel="external"><code>fieldM.H</code></a>，而这个宏里涉及到的类似 <code>List_ELEM</code> 这样的宏，则定义在 <a href="http://foam.sourceforge.net/docs/cpp/a07587_source.html" target="_blank" rel="external"><code>ListLoopM.H</code></a>。</p>
<p>看了这么多，仍然无法完全确定这两个函数的具体的行为。主要的障碍在于那个 <code>pow</code> 函数实在看不明白。最后只好来对这两个函数进行了一些测试，测试结果总结如下：<br><figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="title">transform</span><span class="params">(tensorField p1, vectorField p2)</span></span></span><br></pre></td></tr></table></figure></p>
<p>返回的是另一个 <code>vectorField</code> ，其值等于 <code>p1</code> 与 <code>p2</code> 的内积（即点乘）。注意，一般使用过程中总能保证 <code>p1.size() == p2.size()</code>，但是如果 <code>p1.size() &gt; p2.size()</code>， 则返回结果的 <code>size</code> 等于 <code>p2.size()</code> ，值则等于 <code>p1</code> 的前 <code>p2.size()</code> 部分与 <code>p2</code> 的内积。<br><a href="http://www.slideshare.net/fumiyanozaki96/boundary-conditions-in-openfoam" target="_blank" rel="external">Boundary Conditions in OpenFOAM</a> 这个 silde 也提到了29页也同样提到了 <code>transform</code> 函数的作用<br><figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">inline scalar transform(constsymmTensor&amp;, <span class="keyword">const</span> scalar s)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> s;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Cmpt</span>&gt;</span><br><span class="line">inline <span class="type">Vector</span>&lt;<span class="type">Cmpt</span>&gt; transform(<span class="keyword">const</span> symmTensor&amp; stt, <span class="keyword">const</span> <span class="type">Vector</span>&lt;<span class="type">Cmpt</span>&gt;&amp; v)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> stt &amp; v;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>而 <code>transformFieldMask</code><br><figure class="highlight lisp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">transformFieldMask&lt;Type&gt;<span class="list">(<span class="keyword">pow&lt;vector</span>, pTraits&lt;Type&gt;:<span class="keyword">:rank&gt;</span><span class="list">(<span class="keyword">diag</span>)</span>)</span></span><br></pre></td></tr></table></figure></p>
<p>目前测试的结果是，其返回值等于 <code>diag</code> 。</p>
<p>有了上面对 <code>transform</code> 和 <code>transformFieldMask</code> 两个函数的测试结果，就可以来分析 <code>basicSymmetry</code> 和 <code>directionMixed</code> 两个边界条件的行为了。</p>
<h5 id="basicSymmetry">basicSymmetry</h5><p>对于标量，前面说过其等价于 <code>zeroGradient</code>，所以这里只分析矢量的情形。<br>从 <code>evaluate</code> 函数，可以得到如下公式<br>$$<br>\begin{align}<br>\overrightarrow{\phi}_b = &amp; \left [\overrightarrow{\phi}_c + (\mathrm{I} - 2\overrightarrow{n} \otimes \overrightarrow{n})\cdot \overrightarrow{\phi}_c  \right ] \cdot \frac{1}{2.0} \\<br>= &amp;  \overrightarrow{\phi}_c- \left ( \overrightarrow{\phi}_c \cdot  \overrightarrow{n} \right)\cdot \overrightarrow{n}<br>\end{align}<br>$$<br>这意味着，边界上的值等于其邻近网格中心的值的切向分量。<br>为了方便分析四个系数，将上式写成分量的形式:<br>$$<br>\begin{align}<br>\begin{bmatrix}<br>\phi_{px} \\<br>\phi_{py} \\<br>\phi_{pz}<br>\end{bmatrix} = &amp;<br>\begin{bmatrix}<br>\phi_{cx} \\<br>\phi_{cy} \\<br>\phi_{cz}<br>\end{bmatrix} -<br>\begin{bmatrix}<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_x \\<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_y \\<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_z<br>\end{bmatrix} \\<br>= &amp; \begin{bmatrix}<br>(1-n_xn_x)\phi_{cx} \\<br>(1-n_yn_y)\phi_{cy} \\<br>(1-n_zn_z)\phi_{cz}<br>\end{bmatrix} -<br>\begin{bmatrix}<br>\phi_{cy}n_yn_x + \phi_{cz}n_zn_x \\<br>\phi_{cx}n_xn_y + \phi_{cz}n_zn_y \\<br>\phi_{cx}n_xn_z + \phi_{cy}n_yn_z<br>\end{bmatrix}<br>\end{align}<br>$$<br>照此公式，可以分析得到四个系数如下：<br>$$<br>valueInternalCoeffs =<br>\begin{bmatrix}<br>(1-n_xn_x) \\<br>(1-n_yn_y) \\<br>(1-n_zn_z)<br>\end{bmatrix}<br>$$<br>$$<br>valueBoundaryCoeffs =<br>\begin{bmatrix}<br>\phi_{px} \\<br>\phi_{py} \\<br>\phi_{pz}<br>\end{bmatrix} - valueInternalCoeffs<br>\begin{bmatrix}<br>\phi_{cx} \\<br>\phi_{cy} \\<br>\phi_{cz}<br>\end{bmatrix}<br>$$<br>$$<br>gradientInternalCoeffs= - \Delta<br>\begin{bmatrix}<br>(n_xn_x) \\<br>(n_yn_y) \\<br>(n_zn_z)<br>\end{bmatrix}<br>$$<br>$$<br>gradientBoundaryCoeffs = - \begin{bmatrix}<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_x \\<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_y \\<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_z<br>\end{bmatrix}  \Delta - gradientInternalCoeffs<br>\begin{bmatrix}<br>\phi_{cx} \\<br>\phi_{cy} \\<br>\phi_{cz}<br>\end{bmatrix}<br>$$</p>
<p><strong> 但是，实际上 OpenFOAM 里不是这么实现的</strong>！关键就在于这个 <code>snGradTransformDiag</code> 函数的定义与预期不符。<br>根据我的测试， <code>snGradTransformDiag</code> 函数返回值应该是<br>$$<br>snGradTransformDiag =<br>\begin{bmatrix}<br>|n_x| \\<br>|n_y| \\<br>|n_z|<br>\end{bmatrix}<br>$$<br>即，张量 $\overrightarrow{n}\otimes\overrightarrow{n}$ 的主对角线元素组成的矢量。</p>
<p>而 <code>snGrad</code> 函数的返回值，根据代码可知<br>$$<br>snGrad = - \left ( \overrightarrow{\phi}_c \cdot  \overrightarrow{n} \right)\cdot \overrightarrow{n}\cdot \Delta<br>$$<br>所以，OpenFOAM 中定义的四个系数为：<br>$$<br>valueInternalCoeffs =<br>\begin{bmatrix}<br>(1-|n_x|) \\<br>(1-|n_y|) \\<br>(1-|n_z|)<br>\end{bmatrix}<br>$$<br>$$<br>valueBoundaryCoeffs =<br>\begin{bmatrix}<br>\phi_{px} \\<br>\phi_{py} \\<br>\phi_{pz}<br>\end{bmatrix} - valueInternalCoeffs<br>\begin{bmatrix}<br>\phi_{cx} \\<br>\phi_{cy} \\<br>\phi_{cz}<br>\end{bmatrix}<br>$$<br>$$<br>gradientInternalCoeffs= - \Delta<br>\begin{bmatrix}<br>|n_x| \\<br>|n_y| \\<br>|n_z|<br>\end{bmatrix}<br>$$<br>$$<br>gradientBoundaryCoeffs = - \begin{bmatrix}<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_x \\<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_y \\<br>(\phi_{cx}n_x + \phi_{cy}n_y + \phi_{cz}n_z)n_z<br>\end{bmatrix}  \Delta - gradientInternalCoeffs<br>\begin{bmatrix}<br>\phi_{cx} \\<br>\phi_{cy} \\<br>\phi_{cz}<br>\end{bmatrix}<br>$$</p>
<p>这里的 $\Delta$ 代表代码中的 <code>deltaCoeffs</code> 。</p>
<h5 id="directionMixed">directionMixed</h5><p><code>directionMixed</code> 与 <code>basicSymmetry</code> 是类似的，差别在于 <code>directionMixed</code> 所使用的对称张量是指定的，而不一定是 $\overrightarrow{n}\otimes\overrightarrow{n}$。<br>根据 <code>evaluate</code> 函数，可以得到如下公式：<br>$$<br>\begin{align}<br>\overrightarrow{\phi}_b = &amp; \overrightarrow{\phi}_{ref}\cdot \mathbf{vF} + (\mathrm{I} - \mathbf{vF}) \cdot \left (\overrightarrow{\phi}_c + \frac{\overrightarrow{G}}{\Delta} \right)\\<br>= &amp;  (\mathrm{I} - \mathbf{vF}) \cdot \overrightarrow{\phi}_c + \overrightarrow{\phi}_{ref}\cdot vF + (\mathrm{I} - \mathbf{vF}) \cdot \frac{\overrightarrow{G}}{\Delta}<br>\end{align}<br>$$<br>其中，$\overrightarrow{\phi}_{ref}=refValue$，$\overrightarrow{G}=refGrad$，$\mathbf{vF}=valueFraction$<br>同样，为了方便分析，将上述公式的部分写成分量形式：<br>$$<br>\begin{align}<br>\begin{bmatrix}<br>\phi_{px} \\<br>\phi_{py} \\<br>\phi_{pz}<br>\end{bmatrix} = &amp; \begin{bmatrix}<br>\phi_{cx} \\<br>\phi_{cy} \\<br>\phi_{cz}<br>\end{bmatrix} - \begin{bmatrix}<br>vF_{xx}\phi_{cx} + vF_{xy}\phi_{cy} + vF_{xz}\phi_{cz}\\<br>vF_{yx}\phi_{cx} + vF_{yy}\phi_{cy} + vF_{yz}\phi_{cz} \\<br>vF_{zx}\phi_{cx} + vF_{zy}\phi_{cy} + vF_{zz}\phi_{cz}<br>\end{bmatrix} + \overrightarrow{\phi}_{ref}\cdot \mathbf{vF} + (\mathrm{I} - \mathbf{vF}) \cdot \frac{\overrightarrow{G}}{\Delta} \\<br>= &amp; \begin{bmatrix}<br>(1-vF_{xx})\phi_{cx} \\<br>(1-vF_{yy})\phi_{cy} \\<br>(1-vF_{zz})\phi_{cz}<br>\end{bmatrix} - \begin{bmatrix}<br>vF_{xy}\phi_{cy} + vF_{xz}\phi_{cz}\\<br>vF_{yx}\phi_{cx} + vF_{yz}\phi_{cz} \\<br>vF_{zx}\phi_{cx} + vF_{zy}\phi_{cy}<br>\end{bmatrix} + \overrightarrow{\phi}_{ref}\cdot \mathbf{vF} + (\mathrm{I} - \mathbf{vF}) \cdot \frac{\overrightarrow{G}}{\Delta}<br>\end{align}<br>$$<br>同样的，OpenFOAM 中四个系数的实现也与预期的不一样。主要还是 <code>snGradTransformDiag</code> 的定义与预期的不符:<br>$$<br>snGradTransformDiag =<br>\begin{bmatrix}<br>\sqrt{|vF_{xx}|} \\<br>\sqrt{|vF_{yy}|} \\<br>\sqrt{|vF_{zz}|}<br>\end{bmatrix}<br>$$</p>
<p>结合代码，可以得到四个系数如下：<br>$$<br>valueInternalCoeffs =<br>\begin{bmatrix}<br>(1-\sqrt{|vF_{xx}|}) \\<br>(1-\sqrt{|vF_{yy}|}) \\<br>(1-\sqrt{|vF_{zz}|})<br>\end{bmatrix}<br>$$<br>$$<br>valueBoundaryCoeffs =<br>\begin{bmatrix}<br>\phi_{px} \\<br>\phi_{py} \\<br>\phi_{pz}<br>\end{bmatrix} - valueInternalCoeffs<br>\begin{bmatrix}<br>\phi_{cx} \\<br>\phi_{cy} \\<br>\phi_{cz}<br>\end{bmatrix}<br>$$<br>$$<br>gradientInternalCoeffs= - \Delta<br>\begin{bmatrix}<br>\sqrt{|vF_{xx}|} \\<br>\sqrt{|vF_{yy}|} \\<br>\sqrt{|vF_{zz}|}<br>\end{bmatrix}<br>$$<br>$$<br>gradientBoundaryCoeffs = - \mathbf{vF} \cdot \overrightarrow{\phi}_c \cdot \Delta+ \overrightarrow{\phi}_{ref}\cdot \mathbf{vF} \cdot \Delta + (\mathrm{I} - \mathbf{vF}) \cdot \overrightarrow{G} - gradientInternalCoeffs \cdot \overrightarrow{\phi}_c<br>$$</p>
<p>代码里的 <code>snGrad</code> 函数对应公式为：<br>$$<br>\left [ \overrightarrow{\phi}_{ref}\cdot \mathbf{vF} + (\mathrm{I} - \mathbf{vF}) \cdot (\overrightarrow{\phi}_c + \frac{\overrightarrow{G}}{\Delta}) - \overrightarrow{\phi}_c \right ]\cdot \Delta<br>$$</p>
<p>不知道为什么 <code>snGradTransformDiag</code> 要按照这种方式来定义，可能是为了数值稳定性。不过，由于 <code>valueBoundaryCoeffs</code> 和 <code>gradientBoundaryCoeffs</code> 分别是在 <code>valueInternalCoeffs</code> 和 <code>gradientInternalCoeffs</code> 的基础之上定义的，所以总是能保证 <code>evaluate</code> 的结果与预期一致。</p>
<p>可以将 <code>directionMixed</code> 的行为总结如下：<br><img src="/image/boundaryConditions/boundary-conditions-in-openfoam-90.jpg" alt="directionMixed 的行为"></p>
<p>不过，如果 <code>valueFraction</code> 的值是任意指定的，而不是由 $\overrightarrow{n}\otimes\overrightarrow{n}$ 构成的，那又另当别论了。</p>
<p><strong>参考资料</strong>：<br><a href="http://www.slideshare.net/fumiyanozaki96/boundary-conditions-in-openfoam" target="_blank" rel="external">Boundary Conditions in OpenFOAM</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://xiaopingqiu.github.io/2016/04/02/Boundary-conditions-in-OpenFOAM3/" data-id="cj2lay37q006gkkmbjphjduu5" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Boundary-conditions/">Boundary conditions</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2016/04/02/Boundary-conditions-in-OpenFOAM4/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          OpenFOAM 中的边界条件（四）
        
      </div>
    </a>
  
  
    <a href="/2016/04/02/Boundary-conditions-in-OpenFOAM2/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">OpenFOAM 中的边界条件（二）</div>
    </a>
  
</nav>

  
</article>


<section id="comments">
  <!-- 多说评论框 start -->
  <div class="ds-thread" data-thread-key="post-Boundary-conditions-in-OpenFOAM3" data-title="OpenFOAM 中的边界条件（三）" data-url="http://xiaopingqiu.github.io/2016/04/02/Boundary-conditions-in-OpenFOAM3/"></div>
  <!-- 多说评论框 end -->
  <!-- 多说公共JS代码 start (一个网页只需插入一次) -->
  <script type="text/javascript">
  var duoshuoQuery = {short_name:"xiaopingqiu"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
  <!-- 多说公共JS代码 end -->
</section>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/C/">C++</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/DEM/">DEM</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/OpenFOAM/">OpenFOAM</a><span class="category-list-count">44</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Paraview/">Paraview</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/swak4Foam/">swak4Foam</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/test/">test</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/vim/">vim</a><span class="category-list-count">1</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Boundary-conditions/">Boundary conditions</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/">C++</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CentOS/">CentOS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Code-Explained/">Code Explained</a><span class="tag-list-count">29</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/LES/">LES</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/LIGGGHTS/">LIGGGHTS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ODE/">ODE</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/OpenFOAM/">OpenFOAM</a><span class="tag-list-count">20</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Postprocessing/">Postprocessing</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Preprocessing/">Preprocessing</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RTS/">RTS</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TIL/">TIL</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Windows/">Windows</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/fvOptions/">fvOptions</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/groovyBC/">groovyBC</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/paraview/">paraview</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/thermophysicalModels/">thermophysicalModels</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/turbulence-model/">turbulence model</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wall-functions/">wall functions</a><span class="tag-list-count">4</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Boundary-conditions/" style="font-size: 15.56px;">Boundary conditions</a><a href="/tags/C/" style="font-size: 11.11px;">C++</a><a href="/tags/CentOS/" style="font-size: 10px;">CentOS</a><a href="/tags/Code-Explained/" style="font-size: 20px;">Code Explained</a><a href="/tags/LES/" style="font-size: 10px;">LES</a><a href="/tags/LIGGGHTS/" style="font-size: 10px;">LIGGGHTS</a><a href="/tags/ODE/" style="font-size: 10px;">ODE</a><a href="/tags/OpenFOAM/" style="font-size: 18.89px;">OpenFOAM</a><a href="/tags/Postprocessing/" style="font-size: 17.78px;">Postprocessing</a><a href="/tags/Preprocessing/" style="font-size: 11.11px;">Preprocessing</a><a href="/tags/RTS/" style="font-size: 12.22px;">RTS</a><a href="/tags/TIL/" style="font-size: 10px;">TIL</a><a href="/tags/Windows/" style="font-size: 10px;">Windows</a><a href="/tags/fvOptions/" style="font-size: 11.11px;">fvOptions</a><a href="/tags/groovyBC/" style="font-size: 10px;">groovyBC</a><a href="/tags/paraview/" style="font-size: 10px;">paraview</a><a href="/tags/test/" style="font-size: 11.11px;">test</a><a href="/tags/thermophysicalModels/" style="font-size: 14.44px;">thermophysicalModels</a><a href="/tags/turbulence-model/" style="font-size: 16.67px;">turbulence model</a><a href="/tags/vim/" style="font-size: 10px;">vim</a><a href="/tags/wall-functions/" style="font-size: 13.33px;">wall functions</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/">五月 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">八月 2016</a><span class="archive-list-count">8</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/06/">六月 2016</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/05/">五月 2016</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">四月 2016</a><span class="archive-list-count">12</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">三月 2016</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">十二月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">十一月 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">十月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">九月 2015</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">八月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">六月 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/05/">五月 2015</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/04/">四月 2015</a><span class="archive-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2017/05/12/duoshuoAnnouncement/">多说评论系统将停止提供服务</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewScritps/">Paraview 脚本一例</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewCamera/">Paraview 中有关 Camera 的操作两例</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewCustomFilter/">Paraview 中创建 Custom Filter</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewStreamLineOnSlice/">在 Paraview 中画截面上的流线</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2017 Giskard Q.<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

<script src="//dn-lbstatics.qbox.me/lbservice/busuanzi/2.0/busuanzi.mini.js"/></script>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/atom.xml" class="mobile-nav-link">Rss</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css">
  <script src="/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script>


<script src="/js/script.js" type="text/javascript"></script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-62501686-1', 'auto');
  ga('send', 'pageview');

</script>

  </div>
<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</body>
</html>